var base
var Shop

func _ready():
	pass

func _init():
	call_deferred("Init")

func _connect():
	pass

func Init():
	if globalData.infoDs.has("g_ZHPBase"):
		base = globalData.infoDs["g_ZHPBase"]
	if base != null:
		Shop = globalData.infoDs["g_ZHPShop"]
		base.connect("onStartGame",self,"StartGame")
		# sys.add_child(self)

func StartGame():
	sys.main.connect("onTongGuan", self, "TongGuan")

func TongGuan(x):
	yield(sys.get_tree().create_timer(0.5),"timeout")
	if base.setting.get("zhp") == true:
		sys.newBaseMsg(tr("g_Battletext_1"),tr("g_Battletext_2"))
		if sys.main.batLLv > 4:
			Shop.points += sys.rndRan(150,200)
		else:
			Shop.points += sys.rndRan(100,150)
		Shop.PointsaveAndload("save")